package com.villaday.idf.custom.pop;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

//public class OrderInputPopup extends BasePopupWindow {
//
//    Activity activity;
//    Context context;
//    private final Handler mHandler;
//
//    public OrderInputPopup(final Context context, final Activity activity, final OrderPrepareEntity mOrderPrepareEntity, int homeNum) {
//        super(context);
//        this.activity = activity;
//        this.context = context;
//        buildAnima();
//        setBackground(0);
//        setOutSideDismiss(true);
//        setKeepSize(true);
//        setBlurBackgroundEnable(true);
//        mHandler = new Handler();
//        OrderPrepareEntity.BodyBean mPrepareBody = mOrderPrepareEntity.getBody();
//
//        TextView tvMe = (TextView) findViewById(R.id.tv_md_me);
//        LinearLayout llMe = (LinearLayout) findViewById(R.id.ll_md_me);
//
//        TextView tvBalance = (TextView) findViewById(R.id.tv_md_balance);
//        LinearLayout llBalance = (LinearLayout) findViewById(R.id.ll_md_balance);
//
//
//        TextView tvReduceTitle = (TextView) findViewById(R.id.tv_reduce_title);
//        TextView tvReduce = (TextView) findViewById(R.id.tv_md_reduce);
//        LinearLayout llReduce = (LinearLayout) findViewById(R.id.ll_md_reduce);
//        llReduce.setVisibility(View.GONE);
//        TextView tvOld = (TextView) findViewById(R.id.tv_md_old);
//        LinearLayout llOld = (LinearLayout) findViewById(R.id.ll_md_old);
//
//
//        TextView tvMdMoney = (TextView) findViewById(R.id.tv_md_money);
//
//        TextView tvMdConfirm = (TextView) findViewById(R.id.tv_md_confirm);
//        tvMdConfirm.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                dismiss();
//            }
//        });
//
//        RecyclerView rvDetails = (RecyclerView) findViewById(R.id.rv_md_details);
//
//
////        tvMdMoney.setText(getTotal() + "");
//
//        if (mPrepareBody.getDiscountAmountValue() != null
//                && !mPrepareBody.getDiscountAmountValue().equals("")
//                && !mPrepareBody.getDiscountAmountValue().equals("0")) {
//            tvMe.setText("- ￥" + homeNum * Float.parseFloat(mPrepareBody.getDiscountAmountValue()));
//            String htmlStr = "加返" + "<font color='#F73637'>" +
//                    CalendarUtil.double2String((homeNum * Float.parseFloat(mPrepareBody.getAddBrokerageAmountValue())) + "")
//                    + "</font>元将会返还至您的佣金";
//        } else {
//            llMe.setVisibility(View.GONE);
//        }
//
//        if (mPrepareBody.isAllowUseWallet()) {
//            tvBalance.setText("- ￥" + mPrepareBody.getWalletDeductibleAmountValue());
//        } else {
//            llBalance.setVisibility(View.GONE);
//        }
//
//        if (mPrepareBody.getStayDiscountAmountValue() != null && !mPrepareBody.getStayDiscountAmountValue().equals("")) {
//            tvOld.setText("- ￥" + mPrepareBody.getStayDiscountAmountValue());
//        } else {
//            llOld.setVisibility(View.GONE);
//        }
//
//        if (!mPrepareBody.isAllowUseWallet() && mPrepareBody.getTotalDiscountAmountValue().equals("0")) {
//            tvReduceTitle.setVisibility(View.GONE);
//            llReduce.setVisibility(View.GONE);
//            llOld.setVisibility(View.GONE);
//            llBalance.setVisibility(View.GONE);
//            llMe.setVisibility(View.GONE);
//        }
//
//
//        List<OrderPrepareEntity.BodyBean.ProductBean.ChildProductBean.PriceListBean> priceList = mPrepareBody.getProduct().getChildProduct().getPriceList();
//        List<DataEntity> list = new ArrayList<>();
//        for (int i = 0; i < priceList.size(); i++) {
//            DataEntity dataEntity = new DataEntity();
//            dataEntity.setTitle(priceList.get(i).getDayValue());
//
//
//            if (priceList.get(i).getPriceValue() != null) {
//                String priceValue = priceList.get(i).getPriceValue();
//                String[] xes = priceValue.split("x");
//                if (xes.length > 1) {
//                    dataEntity.setContent(homeNum + " x " + xes[1]);
//                } else {
//                    dataEntity.setContent(priceValue);
//                }
//            } else {
//                dataEntity.setContent("");
//            }
//            list.add(dataEntity);
//        }
//
//        rvDetails.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false));
//        OrderDeatailsPopuAdapter orderDeatailsPopuAdapter = new OrderDeatailsPopuAdapter(context);
//        rvDetails.setAdapter(orderDeatailsPopuAdapter);
//        orderDeatailsPopuAdapter.setData(list);
//    }
//
//
//    private AnimationSet mAnimationSet;
//
//    private void buildAnima() {
//        ScaleAnimation mScaleAnimation = new ScaleAnimation(1f, 2f, 1f, 2f, Animation.RELATIVE_TO_SELF, 0.5f,
//                Animation.RELATIVE_TO_SELF, 0.5f);
//        mScaleAnimation.setDuration(200);
//        mScaleAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
//        mScaleAnimation.setFillAfter(false);
//
//        AlphaAnimation mAlphaAnimation = new AlphaAnimation(1, .2f);
//        mAlphaAnimation.setDuration(400);
//        mAlphaAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
//        mAlphaAnimation.setFillAfter(false);
//
//        mAnimationSet = new AnimationSet(false);
//        mAnimationSet.setDuration(400);
//        mAnimationSet.addAnimation(mScaleAnimation);
//        mAnimationSet.addAnimation(mAlphaAnimation);
//        mAnimationSet.setAnimationListener(new Animation.AnimationListener() {
//            @Override
//            public void onAnimationStart(Animation animation) {
//
//            }
//
//            @Override
//            public void onAnimationEnd(Animation animation) {
//                mHandler.postDelayed(new Runnable() {
//                    @Override
//                    public void run() {
//                        dismiss();
//                    }
//                }, 150);
//
//            }
//
//            @Override
//            public void onAnimationRepeat(Animation animation) {
//
//            }
//        });
//    }
//
//
//    @Override
//    protected Animation onCreateShowAnimation() {
//        Animation showAnima = new TranslateAnimation(Animation.RELATIVE_TO_PARENT,
//                1f,
//                Animation.RELATIVE_TO_PARENT,
//                0,
//                Animation.RELATIVE_TO_PARENT,
//                0,
//                Animation.RELATIVE_TO_PARENT,
//                0);
//        showAnima.setInterpolator(new DecelerateInterpolator());
//        showAnima.setDuration(350);
//        return showAnima;
//    }
//
//    @Override
//    protected Animation onCreateDismissAnimation() {
//        Animation exitAnima = new TranslateAnimation(Animation.RELATIVE_TO_PARENT,
//                0f,
//                Animation.RELATIVE_TO_PARENT,
//                1f,
//                Animation.RELATIVE_TO_PARENT,
//                0,
//                Animation.RELATIVE_TO_PARENT,
//                0);
//        exitAnima.setInterpolator(new DecelerateInterpolator());
//        exitAnima.setDuration(350);
//        return exitAnima;
//    }
//
//    @Override
//    public View onCreateContentView() {
//        return createPopupById(R.layout.zx);
//    }
//}
